<template>
  <el-cascader
    v-model="regions"
    :props="props"
    clearable />
</template>
<script>
import sysProvinceRegions from '@/api/provinceRegions'
export default {
  name: 'ProvinceRegions',
  data() {
    return {
      regions: [],
      props: {
        formRegions: {
          type: String,
          default: '30,356,3240'
        },
        lazy: true,
        lazyLoad(node, resolve) {
          sysProvinceRegions.getByParentId({ parentId: node.value }).then(resp => {
            const nodes = resp.data.map(item => ({
              value: item.id,
              label: item.name,
              leaf: item.level > 1
            }))
            resolve(nodes)
          })
        }
      }
    }
  },
  beforeMount() {
    console.log(this.formRegions)
  },
  methods: { }
}
</script>
<style></style>
